# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=xdg-desktop-portal
pkgver=1.18.2
pkgrel=0
pkgdesc="Desktop integration portal"
url="https://github.com/flatpak/xdg-desktop-portal"
arch="all"
license="LGPL-2.1-or-later"
depends="bubblewrap cmd:fusermount3"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="
	flatpak
	flatpak-dev
	fontconfig-dev
	fuse3-dev
	geoclue-dev
	gettext-dev
	glib-dev
	json-glib-dev
	libportal-dev
	meson
	pipewire-dev
	py3-docutils
	xmlto
	"
checkdepends="py3-dbusmock"
subpackages="$pkgname-dev $pkgname-lang $pkgname-doc"
source="https://github.com/flatpak/xdg-desktop-portal/releases/download/$pkgver/xdg-desktop-portal-$pkgver.tar.xz"
# check: requires geoclue to be running as a system service.
options="!check"

build() {
	abuild-meson \
		-Db_lto=true \
		-Dsystemd=disabled \
		-Dman-pages=enabled \
		-Ddocbook-docs=disabled \
		. output
	meson compile -C output
}

check() {
	TEST_IN_CI=true meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	cd "$pkgdir"

	# We don't need this
	rm -rf usr/lib/systemd

	mkdir -p usr/lib
	mv usr/share/pkgconfig usr/lib/
}

sha512sums="
937fea3dfa0ab4b99146fbf5e4e42fdd94a22ab204f45395257c562e97803e71a777ca17faa5077205a1dd6b7d86291dfeed75922e311a61a402ebf4e05cfa19  xdg-desktop-portal-1.18.2.tar.xz
"
